#include <stdio.h>

int main( )
{
    int num;
    int len;
    int ret;
    FILE *fp;
    char buf[2408];
    int file_len = 523;
    
    if( (fp=fopen( "mfile.c", "rb" )) == NULL )
    {
        return -1;
    }
    
    /*read file and put read content into send buffer*/
    /*num use to calculate send bytes*/
    num = 0;
    while( 1 )
    {
        if(!feof(fp))
        {
            memset( buf, 0x00, sizeof(buf) );
            len=fread( buf, 1, sizeof(buf), fp );
            printf( "get cont len[%d] %s\n", len, buf );
            num += len;
            if( file_len == num )
            {
                break;
            }
        }
    }

    /*clsoe file handle*/
    close(fp);
    return num;
}


